package szte.objectorgy.collections;

import java.util.NoSuchElementException;

/**
 * Queue data structure with a linked-list underlying implementation.
 * 
 * @author Csilla-Andrea KAPUSI
 * @param <T>
 *            The type of the elements stored in this collection.
 */
public class Queue<T extends Comparable<T>> extends LinkedList<T>
{
	public Queue(){
		super();
	}
	
	public T pop()
	{
		if(size() > 0){
			T result = head.getElement();
			head = head.getNext();
			size--;
			return result;
		} else {
			throw new NoSuchElementException();
		}
	}
	
	public void push(T element)
	{
		add(element);
	}
}
